<?php
// 引入客户端文件
require_once __DIR__ . "/Thrift/ClassLoader/ThriftClassLoader.php";
use Thrift\ClassLoader\ThriftClassLoader;

$loader = new ThriftClassLoader();
$loader->registerNamespace('Thrift', __DIR__);
$loader->registerNamespace('Services', __DIR__);
$loader->registerDefinition('Services',  __DIR__);
$loader->register();

$socket = new Thrift\Transport\TSocket("127.0.0.1", 1234);
$transport = new Thrift\Transport\TBufferedTransport($socket, 1024, 1024);
$protocol = new Thrift\Protocol\TBinaryProtocol($transport);
$transport->open();

$client = new Services\Hello\myServiceClient($protocol);
$req = new Services\Hello\Req(array('count' => 12, 'name' => 'hahah'));
$ret = $client->getStudents($req);
var_dump($ret);

$transport->close();

